﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HynuIOTA.IRespository
{
    public partial interface IDBSession
    {
        /// <summary>
        /// 将实体更改保存到数据库
        /// </summary>
        /// <returns></returns>
        int SaveChanges();

        /// <summary>
        /// 将实体更改保存到数据库 -  异步
        /// </summary>
        /// <returns></returns>
        Task<int> SaveChangesAsync();

        /// <summary>
        /// Sql语句执行命令
        /// </summary>
        /// <param name="sqlCommand"></param>
        /// <returns></returns>
        int ExecuteSqlCommand(string sqlCommand);

        /// <summary>
        /// Sql语句执行命令 - 异步
        /// </summary>
        /// <param name="sqlCommand"></param>
        /// <returns></returns>
        Task<int> ExecuteSqlCommandAync(string sqlCommand);

        /// <summary>
        /// Sql语句执行查询
        /// </summary>
        /// <param name="sqlQuery"></param>
        /// <returns></returns>
        DbRawSqlQuery<T> SqlQuery<T>(string sqlQuery);
    }
}
 